package com.jack.leetcode.每日一题;

public class 每日温度 {

    public static void main(String[] args) {
        int[] a = {73, 74, 75, 71, 69, 72, 76, 73};
        int[] result = dailyTemperatures(a);
        for(Integer i:result){
            System.out.print(i+",");
        }
    }

    public static int[] dailyTemperatures(int[] T) {
        if(T == null){
            return null;
        }
        int n = T.length;
        int[] result = new int[n];
        for(int i = 0;i < n;i++){
            for(int j = i+1;j < n;j++){
                if(T[j] > T[i]){
                    result[i] = j - i;
                    break;
                }
            }
        }
        return result;
    }
}
